﻿namespace SERFLITEMAX20.Search
{
    using SERFLITEMAX20.Core;
    using System;
    using System.Diagnostics;
    using System.Threading;

    internal class Program
    {
        private static Thread mSearchThread = null;
        private static Thread mThread = null;

        private static void Main(string[] args)
        {
            Console.WriteLine("Welcom to SERFLITEMAX20");
            Console.WriteLine("waiting for wow...");
            while (Process.GetProcessesByName("WoW").Length == 0)
            {
                if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                {
                    return;
                }
            }
            Console.WriteLine("wow found now starting");
            SERFLITEMAX20.Core.Main parameter = new SERFLITEMAX20.Core.Main();
            parameter.StartSearch();
            mSearchThread = new Thread(new ParameterizedThreadStart(Program.SearchMemory));
            mSearchThread.Start(parameter);
            Console.WriteLine("SERFLITEMAX20 started");
            while (parameter.HasStarted)
            {
                Console.ReadLine();
                break;
            }
        }

        private static void SearchMemory(object sender)
        {
            ((SERFLITEMAX20.Core.Main) sender).Memory.DumpData();
        }

        private static void UpdateStatus(string pStatus, bool attention)
        {
            Console.WriteLine(pStatus);
        }
    }
}

